<?php

declare(strict_types=1);

namespace JfbQueue;

use JfbQueue\Driver\DriverInterface;
use Hyperf\Context\ApplicationContext;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Process\Annotation\Process;
use Hyperf\Process\ProcessManager;
use Hyperf\Redis\RedisFactory;
use Hyperfx\Framework\Exception\AppException;
use Hyperfx\Framework\Logger\Logx;
use Hyperfx\Utils\AppEnvUtil;
use Hyperfx\Utils\RunModeUtil;
use Psr\Container\ContainerInterface;
use Hyperf\Process\AbstractProcess;


class JobX  {
    public function __construct(protected DriverInterface $driver)
    {

    }

    public function publish(array $messages, int $delay = 0): array|bool
    {
        return $this->driver->push($messages);
    }
    
    public function length(): int
    {
        return $this->driver->len();
    }

    public function test(): array
    {
         $ret = $this->driver->reload();
         var_dump($ret);
        // $ret = $this->driver->pop();
        // var_dump($ret);
        return [];
    }
}